//
//  VenueModel.m
//  fitnessmanage
//
//  Created by 众拳科技 on 2017/11/20.
//  Copyright © 2017年 zongquankeji. All rights reserved.
//

#import "VenueModel.h"

#define VenueFilePath [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@venue.data",[[NSUserDefaults standardUserDefaults]objectForKey:@"UserID"]]]

@implementation VenueModel

MJCodingImplementation


+ (NSDictionary *)replacedKeyFromPropertyName{
    return @{
             @"venueId" : @"ID",
             @"venueAddres" : @"Address",
             @"venuePic" : @"Pic",
             @"venueName" : @"Name",
             @"phone" : @"Tel",
             @"venueInfo" : @"Description"
             };
}

+ (void)saveVenue:(VenueModel *)venue
{
    // 归档
    [NSKeyedArchiver archiveRootObject:venue toFile:VenueFilePath];
}

+(VenueModel *)venue
{
    // 读取帐号
    VenueModel *venue = [NSKeyedUnarchiver unarchiveObjectWithFile:VenueFilePath];
    
    if (!venue) {
        
        venue = [[VenueModel alloc] init];
    }
    
    return venue;
}

@end
